//
//  XMTaskListTableViewCell.m
//  XunMi
//
//  Created by MacBook on 2024/3/19.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMTaskListTableViewCell.h"
#import "XMTaskModel.h"


@implementation XMTaskListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.countBtn setImage:kGetImage(kUserModel.isMan ? @"task_gold" : @"task_point") forState:UIControlStateNormal];
}

- (void)setModel:(XMTaskModel *)model {
    _model = model;
    self.taskTitleLa.text = kStringFormat(@"%@(%@/%@)", model.task_name, model.complete_process, model.required_process);
    self.desLa.text = model.task_describe;
    [self.countBtn setTitle:kStringFormat(@"+%@", model.award_number) forState:UIControlStateNormal];
    /// 任务操作状态  -1 已完成  0 未完成  1 待领取
    switch (model.handle_status.intValue) {
        case -1:
            self.actBtn.enabled = NO;
            break;
        case 0:
            self.actBtn.enabled = YES;
            [self.actBtn setTitle:@"去完成" forState:UIControlStateNormal];
            break;
        case 1:
            self.actBtn.enabled = YES;
            [self.actBtn setTitle:@"待领取" forState:UIControlStateNormal];
            break;
        default:
            break;
    }
}

- (IBAction)gotoAction:(UIButton *)sender {
    if (self.gotoBlock) {
        self.gotoBlock(self.model);
    }
}

@end
